/*
 * @Author: Seon.Hu SeonHu@126.com
 * @Date: 2023-03-15 16:08:34
 * @LastEditors: Seon.Hu SeonHu@126.com
 * @LastEditTime: 2023-03-17 14:58:18
 * @FilePath: \bg-vben\src\components\AdList\src\hooks\useListHeader.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import type { ComputedRef, Slots } from 'vue';
import type { AdListProps } from '../types/adList';
import { unref, computed } from 'vue';

export function useListHeader(propsRef: ComputedRef<AdListProps>, slots: Slots) {
  const getHeaderProps = computed((): Recordable => {
    const { title, titleHelpMessage, listSetting } = unref(propsRef);
    const hideHeader =
      !slots.headerTop && !slots.listTitle && !title && !slots.toolbar && !listSetting;

    return {
      hideHeader,
      title,
      titleHelpMessage,
      listSetting,
    };
  });
  return { getHeaderProps };
}
